home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NT Sources
/
Infomagic - NT Source Volume 1 (Disc 1 of 2).iso
/
network
/
pcdctrla.exe
/
PCDCTRL.EXE
/
PCDSYS.TPU
< prev
next >
Wrap
Text File
|
1997-04-10
|
10KB
|
243 lines
!+++
! PCDUO_SYSTEM_INI.TPU - Edit the Windows SYSTEM.INI file for PC-Duo
!
! v3.60 10-Apr-97 JD - Updated for v3.60
!---
! We have to edit 2 sections: [boot], to change the display.drv= line over to
! use the PC-Duo intercept driver (PCDVGA.DRV) and to load the Windows Client;
! and [386Enh] to load the PC-Duo Virtual Device Driver (PCDVXD.386).
! We also check and may increase NetHeapSize (if it is less than 16).
PROCEDURE PCD_update_system ();
! Declare some local variables - initialised to zero
LOCAL PCD_display_drv, ! The current display.drv contents
PCD_display_pcd, ! display.pcd= line, if present
PCD_display_old, ! display.old= line, if present
PCD_display_position, ! The position of PCDVGA in display,drv
PCD_old_netheapsize, ! The current NetHeapSize value (string)
PCD_new_netheapsize, ! The new NetHeapSize value (integer)
PCD_section_range, ! Used to detect or map file sections
PCD_wclient_line, ! Used to detect a wclient= line
PCD_wfw_enablesharing; ! The WFW EnableSharing= value (string)
! Create a range to map on to the [boot] section
PCD_section_range := LUT_create_range (LINE_BEGIN + "[boot]", LINE_BEGIN + "[");
! Pick up the current display driver value(s) to see if the line(s) exist.
! Use the LUT_start_line_opt_whitespace pattern so we get the right values
! This allows leading whitespace, but nothing else before the keyword.
PCD_display_pcd := LUT_win_get_value ("[boot]", (LUT_start_line_opt_whitespace + "display.pcd"), PCD_section_range);
PCD_display_old := LUT_win_get_value ("[boot]", (LUT_start_line_opt_whitespace + "display.old"), PCD_section_range);
PCD_wclient_line := LUT_win_get_value ("[boot]", (LUT_start_line_opt_whitespace + "wclient") , PCD_section_range);
! LUT_win_get_value positions the cursor at the beginning of the search
! pattern. After the next get_value, it should be at the beginning of the
! display.drv line. If there isn't one present, then the file format is
! not valid.
PCD_display_drv := LUT_win_get_value ("[boot]", (LUT_start_line_opt_whitespace + "display.drv"), PCD_section_range);
! Check the return value. If this is zero, the file is invalid.
If PCD_display_drv <> 0
Then
MESSAGE (FAO ("The current display driver is <!AS>", PCD_display_drv));
! Convert it to UPPER CASE for safer checking
EDIT (PCD_display_drv, UPPER);
! See whether we are already using the PC-Duo display driver
PCD_display_position := INDEX (PCD_display_drv, "PCDVGA.DRV");
If (PCD_display_position = 0)
Then
MESSAGE ("Installing the PC-Duo Display Driver.");
If (PCD_display_pcd <> 0)
Then
! There is already a display.pcd line present, update it.
LUT_text_replace ((LINE_BEGIN + MATCH ("display.pcd") + REMAIN),
"display.pcd=pcdvga.drv", PCD_section_range);
Else
! Take advantage of the cursor position being at the beginning
! of the display.drv line. Open up a new line, add a comment
! and then add the display.pcd line
SPLIT_LINE;
MOVE_VERTICAL (-1);
COPY_TEXT ("; PCD Display Driver");
SPLIT_LINE;
COPY_TEXT ("display.pcd=pcdvga.drv");
Endif;
! Next, update the display.drv line (which must be present).
! This positions the cursor at the end of the display.drv line
LUT_text_replace ((LINE_BEGIN + MATCH ("display.drv") + REMAIN),
"display.drv=pcdvga.drv", PCD_section_range);
! Next, update or add a display.old line
If PCD_display_old <> 0
Then
! There is already a display.old line present, update it.
LUT_text_replace ((LINE_BEGIN + MATCH ("display.old=") + REMAIN),
"display.old=" + PCD_display_drv, PCD_section_range);
Else
! Open up a new line and add a display.old line
SPLIT_LINE;
COPY_TEXT ("display.old=" + PCD_display_drv);
Endif;
Else
MESSAGE ("The PC-Duo Display Driver is already installed. Updating.");
LUT_text_replace ((LINE_BEGIN + MATCH ("display.drv=") + REMAIN),
"display.drv=pcdvga.drv", PCD_section_range);
Endif;
! Lastly, check whether there is already a wclient= line. If so,
! update it, otherwise insert a new one. Here, we assume that we are
! going to load a Client using the NetBIOS DLL and the * Client Name.
! We could read the network= line from [386Enh] to see whether it
! contains "vnetbios" (NetBIOS) or "vipx" (IPX). However, WFW 3.11
! May have vnetbios in network= if it is configured for NWLINK.
! Similarly, we could look for signs of TCP/IP Windows Sockets.
! /uip = IPX, /unb = NetBIOS, /utc = TCP/IP Windows Sockets
If PCD_wclient_line <> 0
Then
! There is already a wclient line present, update it.
MESSAGE ("The PC-Duo Windows Client is already installed. Updating.");
LUT_text_replace ((LINE_BEGIN + MATCH ("wclient=") + REMAIN),
"wclient=c:\pcduo\wclientw.exe * /unb", PCD_section_range);
Else
! We should now be positioned on the display.old line
! Move down, open up a new line and add a wclient= line
MESSAGE ("Installing the PC-Duo Windows Client.");
POSITION (LINE_BEGIN);
MOVE_VERTICAL (1);
COPY_TEXT ("wclient=c:\pcduo\wclientw.exe * /unb");
SPLIT_LINE;
Endif;
! OK. That is [boot] finished. Move on to [386Enh].
! Create a range to map the [386Enh] section.
PCD_section_range := LUT_create_range (LINE_BEGIN + "[386Enh]", LINE_BEGIN + "[");
! Check for PCDVXD.386. This is not at the beginning of a line,
! so don't use the pattern.
PCD_display_drv := LUT_win_get_value ("[386Enh]", "PCDVXD.386", PCD_section_range);
If (PCD_display_drv <> 0)
Then
MESSAGE ("The PC-Duo Virtual Device Driver is already installed. Updating.");
! We can't use LUT_win_line_replace_add to replace device= line(s),
! as it won't get the right line. However, we are positioned at
! "pcdvxd". Move to the beginning of the line, and replace it.
POSITION (LINE_BEGIN);
COPY_TEXT ("device=c:\pcduo\pcdvxd.386");
SPLIT_LINE;
ERASE_LINE;
Else
MESSAGE ("Installing the PC-Duo Virtual Device Driver.");
! Position the cursor at the beginning of the range
! (i.e. on the "[")
POSITION (BEGINNING_OF (PCD_section_range));
MOVE_VERTICAL (1);
COPY_TEXT ("; PCD Virtual Device Driver");
SPLIT_LINE;
COPY_TEXT ("device=c:\pcduo\pcdvxd.386");
SPLIT_LINE;
Endif;
! Next, we check the NetHeapSize. The correct value to use depends
! upon whether we are running Windows for Workgroups or just Windows
! We can find this out by looking for [network] EnableSharing.
! This is only present on WFW (3.1 and 3.11).
PCD_new_netheapsize := 16;
PCD_wfw_enablesharing := LUT_win_get_value ("[network]", (LUT_start_line_opt_whitespace + "EnableSharing"));
! If the line is found, we can check the actual value. We potentially
! need more heap if EnableSharing is "1" (WFW 3.1) or "Yes" (WFW 3.11)
! as these will enable the Protected Mode Server (VSERVER.386).
If (PCD_wfw_enablesharing <> 0)
Then
MESSAGE (FAO ("WFW sharing detected. EnableSharing=!AS", PCD_wfw_enablesharing));
! The default is for sharing to be enabled. Check for disabled.
If ((PCD_wfw_enablesharing = "No")
OR (PCD_wfw_enablesharing = "0"))
Then
PCD_new_netheapsize := 28;
Else
PCD_new_netheapsize := 40;
Endif;
Endif;
! Read the current NetHeapSize. Use the pattern again to make sure
! that we don't get confused by DNETHeapSize
PCD_old_netheapsize := LUT_win_get_value ("[386Enh]", (LUT_start_line_opt_whitespace + "NetHeapSize"), PCD_section_range);
! Check the current NetHeapSize. If it is not present, empty, or less than
! PCD_new_netheapsize, increase the value.
If ((PCD_old_netheapsize = 0)
OR (PCD_old_netheapsize = "")
OR (INT (PCD_old_netheapsize) < PCD_new_netheapsize))
Then
MESSAGE (FAO ("Increasing NetHeapSize to !UL", PCD_new_netheapsize));
LUT_win_line_replace_add ("[386Enh]", "NetHeapSize=", "NetHeapSize=" + STR (PCD_new_netheapsize));
Else
MESSAGE (FAO ("Current NetHeapSize is !AS", PCD_old_netheapsize));
Endif;
Else
MESSAGE ("Invalid SYSTEM.INI file format. Aborting.");
Quit;
Endif;
Endprocedure;
LUT_start_edit (); ! This reads the file (if it exists), creates a buffer,
! and positions us at the top of the buffer
IF LUT_buffer_empty
THEN
quit; ! Error - the input file must exist!
ENDIF;
! Do the update
PCD_update_system ();
! And now perform 'standard' finishing functions...
LUT_finish_edit ();